<template>
	<view class="container">
		<view class="ListBox">
			<view class="ListItem" v-for="item in list" v-if="list.length>0">
				<view class="list">
					<text class="name">{{item.placeName}}</text>
					<text class="jg" v-if="item.examineStatus=='1'">{{ app.language.shtg }}</text>
					<text class="jgNo" v-if="item.examineStatus=='0'">{{ app.language.shbtg }}</text>
					<text class="jgD" v-if="item.examineStatus==null">{{ app.language.dsp }}</text>
				</view>
				<view class="sqTime">{{ app.language.sqTime }}：{{item.createTime}}</view>
				<!-- <view class="sqTime" v-if="item.examineStatus=='1'">预约办理时间：{{item.appointmentTime}}</view> -->
				<view class="sqTime" v-if="item.examineStatus=='0'">{{ app.language.btgyy }}：{{item.examineopinion}}
				</view>
				<view class="cb" v-if="item.examineStatus==null">
					{{ app.language.cbPhone }}：{{item.cbphone}}
				</view>
			</view>
			<view class="list" v-if="list.length==0">
				<nullVue></nullVue>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getgetAppEntertainmentvenues
	} from '@/api/domicile.js'
	const global = getApp().globalData;
	import nullVue from '@/components/null';
	export default {
		components: {
			nullVue
		},
		data() {
			return {
				app: {
					global: global,
					name: global.appName,
					language: global.language
				},
				token: "",
				userInfo: {},
				list: [],

			}
		},

		onLoad() {
			this.getToken()
			setTimeout(() => {
				this.getList()
			}, 1000);

		},
		methods: {
			getToken() {
				let that = this
				uni.getStorage({
					key: 'loginData',
					success: function(res) {
						that.token = res.data.userInfo.appToken
						that.userInfo = res.data.userInfo
						console.log('1', that.userInfo)
					}
				});
			},

			// 查列表数据
			getList() {
				console.log('token', this.token)
				uni.showLoading({
					title: this.app.language.jzz,
				});
				let data = {
					appToken: this.token,
					// uuid: this.userInfo.uuid
				}
				getgetAppEntertainmentvenues(data).then((res) => {
					if (res.code == 200) {
						uni.hideLoading();
						this.list = res.data
						for (let i = 0; i < this.list.length; i++) {
							const date = new Date();
							const y = new Date(this.list[i].createTime).getFullYear();
							const m = new Date(this.list[i].createTime).getMonth() +
								1; // 月份是从0开始的
							const d = new Date(this.list[i].createTime).getDate();
							this.list[i].createTime =
								`${y}-${m.toString().padStart(2, '0')}-${d.toString().padStart(2, '0')}`;
						}
					}

				})
			}

		},
	}
</script>

<style>
	.container {
		padding: 20rpx;
	}

	.ListItem {
		background-color: #fff;
		box-shadow: 2rpx 2rpx 10rpx #ddd;
		border-radius: 5rpx;
		margin-bottom: 20rpx;
		padding: 15rpx;
	}

	.list {
		display: flex;
		border-bottom: 1px solid #ebebeb;
		padding: 10rpx 0;
	}

	.name {
		font-weight: bold;
		margin-bottom: 10rpx;
		font-size: 26rpx;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
		overflow: hidden;
		text-overflow: ellipsis;
		width: 66%;
	}

	.jg {
		margin-left: auto;
		font-size: 24rpx;
		border: 1px solid #59bea0;
		padding: 5rpx 10rpx;
		border-radius: 5rpx;
		color: #59bea0;
		width: 123rpx;
		text-align: center;
	}

	.sqTime {
		margin: 25rpx 0;
		font-size: 26rpx;
	}

	.cb {
		font-size: 26rpx;
	}

	.jgNo {
		margin-left: auto;
		font-size: 24rpx;
		border: 1px solid #d6605c;
		padding: 5rpx 10rpx;
		border-radius: 5rpx;
		color: #d6605c;
		width: 123rpx;
		text-align: center;
	}

	.jgD {
		margin-left: auto;
		font-size: 24rpx;
		border: 1px solid #909399;
		padding: 5rpx 10rpx;
		border-radius: 5rpx;
		color: #909399;
		width: 123rpx;
		text-align: center;
	}
</style>